package com.xxx.video.network.utils;


import android.provider.Settings;
import android.text.TextUtils;

import com.xxx.video.VideoApplication;
import com.xxx.video.commen.configs.NetWorkConstant;
import com.xxx.video.commen.configs.UserManager;
import com.xxx.video.dynamic.beans.ClientContactBean;
import com.xxx.video.dynamic.beans.ClientLocationBean;
import com.xxx.video.dynamic.beans.DeviceBean;
import com.xxx.video.dynamic.beans.NetWorkInfoBean;
import com.xxx.video.login.beans.RegisterSecondQuestionBean;
import com.xxx.video.network.clients.CommonOkHttpClient;
import com.xxx.video.network.listeners.CommonResponseListener;
import com.xxx.video.network.requests.RequestParams;
import com.xxx.video.network.responses.DisposeDataHandle;

import java.io.File;
import java.util.ArrayList;
import java.util.List;


public class NetWorkUtils {
    private static NetWorkUtils mNetWorkUtils = null;

    private NetWorkUtils() {
    }

    public static NetWorkUtils getInstance() {
        if (mNetWorkUtils == null) {
            synchronized (NetWorkUtils.class) {
                if (mNetWorkUtils == null) {
                    mNetWorkUtils = new NetWorkUtils();
                }
            }
        }
        return mNetWorkUtils;
    }


    /**
     * get common request params
     *
     * @return common request params
     */
    public RequestParams getCommonRequestParams() {
        String androidId = "";
        try {
            androidId = Settings.System.getString(VideoApplication.getInstance().getContentResolver(), Settings.System.ANDROID_ID);
        } catch (Exception e) {
            e.printStackTrace();
        }
        RequestParams requestParams = new RequestParams()
                .addHeaders("token", UserManager.getInstance().getToken())
                .addHeaders("deviceId", androidId);
        return requestParams;
    }

    /**
     * register
     *
     * @param userName user name
     * @param pwd      pwd
     * @param phone    phone
     * @param email    email
     * @param nickName nickName
     */
    public void register(String userName, String pwd, String phone, String email, String nickName, List<RegisterSecondQuestionBean> questionBeanList, String deviceId, String longitude, String latitude, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("username", userName)
                .addParams("password", pwd)
                .addParams("deviceId", deviceId)
                .addParams("longitude", longitude)
                .addParams("latitude", latitude)
                .addParams("secretGuard", questionBeanList)
                .setUrl(NetWorkConstant.register);
        if (!TextUtils.isEmpty(phone)) {
            requestParams.addParams("mobile", phone);
        }
        if (!TextUtils.isEmpty(email)) {
            requestParams.addParams("email", email);
        }
        if (!TextUtils.isEmpty(nickName)) {
            requestParams.addParams("nickName", nickName);
        }
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * login
     *
     * @param account                account
     * @param pwd                    pwd
     * @param commonResponseListener common response listener
     */
    public void login(String account, String pwd, String deviceId, String longitude, String latitude, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("username", account)
                .addParams("password", pwd)
                .addParams("deviceId", deviceId)
                .addParams("longitude", longitude)
                .addParams("latitude", latitude)
                .setUrl(NetWorkConstant.login);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get security options
     *
     * @param commonResponseListener listener
     */
    public void getSecurityOptions(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getSecurityOptions);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * for get pwd
     *
     * @param userName               user name
     * @param pwd                    pwd
     * @param commonResponseListener listener
     */
    public void forgetPassword(String userName, String pwd, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("username", userName)
                .addParams("password", pwd)
                .setUrl(NetWorkConstant.forgetPassword);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get secret guard
     */
    public void getSecretGuard(String userName, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("username", userName)
                .setUrl(NetWorkConstant.getSecretGuard);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get user info
     *
     * @param commonResponseListener listener
     */
    public void getUser(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getUser);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * upload file
     *
     * @param file                   file
     * @param commonResponseListener listener
     */
    public void uploadFile(File file, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addFileParams(file.getAbsolutePath(), file)
                .setUrl(NetWorkConstant.uploadFile);
        CommonOkHttpClient.getInstance().uploadFileProgress(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * upload file
     *
     * @param file                   file
     * @param commonResponseListener listener
     */
    public void uploadPhoto(File file, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addFileParams(file.getAbsolutePath(), file)
                .setUrl(NetWorkConstant.uploadPhoto);
        CommonOkHttpClient.getInstance().uploadFileProgress(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * update user info
     *
     * @param mobile                 mobile
     * @param nickName               nickname
     * @param email                  email
     * @param picurl                 picurl
     * @param commonResponseListener listener
     */
    public void updateInfo(String mobile, String nickName, String email, String picurl, String gender, String age, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.updateUser);
        if (!TextUtils.isEmpty(mobile)) {
            requestParams.addParams("mobile", mobile);
        }
        if (!TextUtils.isEmpty(nickName)) {
            requestParams.addParams("nickName", nickName);
        }
        if (!TextUtils.isEmpty(email)) {
            requestParams.addParams("email", email);
        }
        if (!TextUtils.isEmpty(picurl)) {
            requestParams.addParams("picurl", picurl);
        }
        if (!TextUtils.isEmpty(gender)) {
            requestParams.addParams("sex", gender);
        }
        if (!TextUtils.isEmpty(age)) {
            requestParams.addParams("age", age);
        }
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * get feed back type list
     *
     * @param commonResponseListener listener
     */
    public void getFeedBackTypeList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getFeedbackType);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * feed back
     *
     * @param feedBackTypeId   id
     * @param feedBackTypeName name
     * @param feedBackContent  content
     * @param email            email
     * @param mImageList       image list
     */
    public void feedBack(String feedBackTypeId, String feedBackTypeName, String feedBackContent, String email, String mImageList, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fTypeId", feedBackTypeId)
                .addParams("fTypeName", feedBackTypeName)
                .addParams("fContent", feedBackContent)
                .setUrl(NetWorkConstant.feedback);
        if (!TextUtils.isEmpty(email)) {
            requestParams.addParams("fEmail", email);
        }
        if (!TextUtils.isEmpty(mImageList)) {
            requestParams.addParams("fFile", mImageList);
        }
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get view list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getViewList(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "15")
                .setUrl(NetWorkConstant.getViewList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * get praise list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getPraiseList(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "15")
                .setUrl(NetWorkConstant.getPraiseList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get getDownloadList list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getDownloadList(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "15")
                .setUrl(NetWorkConstant.getDownloadList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get comment list
     *
     * @param commonResponseListener listener
     */
    public void getCommentList(int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getCommentList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get index
     *
     * @param commonResponseListener listener
     */
    public void index(int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.index);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get type list
     *
     * @param commonResponseListener listener
     */
    public void getTypeInfoList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getTypeInfoList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get type list
     *
     * @param commonResponseListener listener
     */
    public void getTypeAllList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getTypeAllList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get channel info
     *
     * @param commonResponseListener listener
     */
    public void getChannelInfo(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getChannelInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get rank list
     *
     * @param page                   page
     * @param type                   type
     * @param commonResponseListener listener
     */
    public void getRankList(int page, String type, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fType", type)
                .addParams("page", String.valueOf(page))
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getRankList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get friend info
     *
     * @param userId                 friend
     * @param commonResponseListener listener
     */
    public void getFriendsInfo(String userId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("userId", userId)
                .setUrl(NetWorkConstant.getFriendsInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get content info
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void getContentInfo(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.getContentInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get comment info
     *
     * @param page                   page
     * @param videoId                id
     * @param commonResponseListener listener
     */
    public void getCommentInfo(int page, String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fContentId", videoId)
                .addParams("page", String.valueOf(page))
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getCommentInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * deleteComment
     *
     * @param fId                    fId
     * @param commonResponseListener listener
     */
    public void deleteComment(String fId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", fId)
                .setUrl(NetWorkConstant.deleteComment);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * comment
     *
     * @param id                     video id
     * @param commentContent         content
     * @param commonResponseListener listener
     */
    public void comment(String id, String commentContent, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fContentId", id)
                .addParams("fContent", commentContent)
                .setUrl(NetWorkConstant.comment);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get type info
     *
     * @param id id
     */
    public void getTypeInfo(String id, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", id)
                .setUrl(NetWorkConstant.getTypeInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get message
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getMessage(int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.getMessage);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get dynamic list
     *
     * @param type                   0:voice 1:video
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getDynamicList(String type, String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fType", type)
                .addParams("page", page)
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getDynamicList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get dynamic list
     *
     * @param type                   0:voice 1:video
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void dynamicList(String type, String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fType", type)
                .addParams("page", page)
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.dynamicList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * release
     *
     * @param videoPath              video path/voice path
     * @param videoCoverPath         video cover path
     * @param videoTitle             videoTitle
     * @param fType                  type 0:voice 1:video
     * @param commonResponseListener listener
     */
    public void release(String videoPath, String videoCoverPath, String videoTitle, String fType, String fDuring, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fVideo", videoPath)
                .addParams("fType", fType)
                .addParams("fDuring", fDuring)
                .setUrl(NetWorkConstant.release);
        if (!TextUtils.isEmpty(videoTitle)) {
            requestParams.addParams("fTitle", videoTitle);
        }
        if (!TextUtils.isEmpty(videoTitle)) {
            requestParams.addParams("fPicurl", videoCoverPath);
        }
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get user interaction
     *
     * @param id                     id
     * @param page                   user name
     * @param commonResponseListener listener
     */
    public void getUserInteraction(String id, String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", id)
                .addParams("page", page)
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.getUserInteraction);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * fabulous
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void fabulous(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.fabulous);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * search
     *
     * @param searchContent          search content
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void search(String searchContent, String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("token", UserManager.getInstance().getToken())
                .addParams("fKeyword", searchContent)
                .addParams("page", page)
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.search);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get friend list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void getFriendsList(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", page)
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getFriendsList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get recommend friend list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void recommendFriends(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", page)
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.recommendFriends);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get receive friend list
     *
     * @param commonResponseListener listener
     */
    public void getReceivedFriendsList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getReceivedFriendsList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * get out friend list
     *
     * @param commonResponseListener listener
     */
    public void getOutFriendsList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getOutFriendsList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * get near by user
     *
     * @param page                   page
     * @param lon                    lon
     * @param lan                    lan
     * @param commonResponseListener listener
     */
    public void nearbyUser(String page, String lon, String lan, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", page)
                .addParams("limit", "10")
                .addParams("longitude", lon)
                .addParams("latitude", lan)
                .setUrl(NetWorkConstant.nearbyUser);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * mail list
     *
     * @param contact                contact
     * @param commonResponseListener listener
     */
    public void mailList(String[] contact, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", "1")
                .addParams("limit", "1000")
                .addParams("mobileList", contact)
                .setUrl(NetWorkConstant.mailList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * browse
     *
     * @param videoId                video id
     * @param type                   0：content 1：dynamic
     * @param commonResponseListener listener
     */
    public void browse(String videoId, String type, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .addParams("fType", type)
                .setUrl(NetWorkConstant.browse);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * add friends
     *
     * @param userId                 user id
     * @param username               user name
     * @param nickName               nick name
     * @param picUrl                 pic url
     * @param commonResponseListener listener
     */
    public void addFriends(String userId, String username,
                           String nickName, String picUrl, String message, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("userId", userId)
                .addParams("username", username)
                .addParams("nickName", nickName)
                .addParams("picUrl", picUrl)
                .addParams("message", message)
                .setUrl(NetWorkConstant.addFriends);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * @param videoId                video id
     * @param type                   type  0：content 1：dynamic
     * @param commonResponseListener listener
     */
    public void play(String videoId, String type, long startTime, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .addParams("fType", type)
                .addParams("fPalyDuring", (System.currentTimeMillis() - startTime) / 1000)
                .setUrl(NetWorkConstant.play);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get dynamic info
     *
     * @param videoId                id
     * @param commonResponseListener listener
     */
    public void getDynamicInfo(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.getDynamicInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * inter action
     *
     * @param videoId                id
     * @param commentContent         content
     * @param commonResponseListener listener
     */
    public void interaction(String videoId, String commentContent, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fDynamicId", videoId)
                .addParams("fContent", commentContent)
                .setUrl(NetWorkConstant.interaction);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * dis like
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void dislike(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.dislike);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * agree friend
     *
     * @param id                     id
     * @param commonResponseListener listener
     */
    public void acceptFriends(String id, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", id)
                .setUrl(NetWorkConstant.acceptFriends);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * un agree friend
     *
     * @param id                     id
     * @param commonResponseListener listener
     */
    public void refuse(String id, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", id)
                .setUrl(NetWorkConstant.refuse);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * remind friend
     *
     * @param fId                    id
     * @param commonResponseListener listener
     */
    public void remindFriends(String fId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", fId)
                .setUrl(NetWorkConstant.remindFriends);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get interactionList
     *
     * @param userId                 user id
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void interactionList(String userId, String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fUserId", userId)
                .addParams("page", page)
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.interactionList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * add Interaction
     *
     * @param userId                 user id
     * @param userName               user name
     * @param content                content
     * @param commonResponseListener listener
     */
    public void addInteraction(String userId, String userName, String content, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fFriendsId", userId)
                .addParams("fContent", content)
                .addParams("fFriendsName", userName)
                .setUrl(NetWorkConstant.addInteraction);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * friends private
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void friendsPrivate(String page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", page)
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.friendsPrivate);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * deleteDynamic
     *
     * @param fId                    id
     * @param commonResponseListener listener
     */
    public void deleteDynamic(String fId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", fId)
                .setUrl(NetWorkConstant.deleteDynamic);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * downloadFollow
     *
     * @param videoId                id
     * @param type                   0：content 1：dynamic
     * @param commonResponseListener listener
     */
    public void downloadFollow(String videoId, String type, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .addParams("fType", type)
                .setUrl(NetWorkConstant.downloadFollow);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * getHistoryKeyword
     *
     * @param commonResponseListener listener
     */
    public void getHistoryKeyword(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getHistoryKeyword);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get recommend list
     *
     * @param commonResponseListener listener
     */
    public void getRecommendList(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getRecommendList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * searchFriends
     *
     * @param searchContent          key
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void searchFriends(String searchContent, int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("key", searchContent)
                .addParams("page", String.valueOf(page))
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.searchFriends);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * collection
     *
     * @param fId                    fId
     * @param fType                  0：content 1：dynamic
     * @param commonResponseListener listener
     */
    public void collection(String fId, String fType, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", fId)
                .addParams("fType", fType)
                .setUrl(NetWorkConstant.collection);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * deleteCollection
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void deleteCollection(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.deleteCollection);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * collection list
     *
     * @param page                   page
     * @param commonResponseListener listener
     */
    public void collectionList(int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("page", String.valueOf(page))
                .addParams("limit", "20")
                .setUrl(NetWorkConstant.collectionList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }


    /**
     * dynamicFabulous
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void dynamicFabulous(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.dynamicFabulous);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * dynamicDislike
     *
     * @param videoId                video id
     * @param commonResponseListener listener
     */
    public void dynamicDislike(String videoId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fId", videoId)
                .setUrl(NetWorkConstant.dynamicDislike);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * getDynamicReview
     *
     * @param commonResponseListener listener
     */
    public void getDynamicReview(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getDynamicReview);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));

    }

    /**
     * get message info
     *
     * @param id                     id
     * @param commonResponseListener listener
     */
    public void getMessageInfo(String id, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fUsermessageId", id)
                .setUrl(NetWorkConstant.getMessageInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * @param contactBeanList        data
     * @param locationBeanList       data
     * @param deviceBean             data
     * @param netWorkInfoBean        data
     * @param commonResponseListener listener
     */
    public void saveUserInfo(List<ClientContactBean> contactBeanList, List<ClientLocationBean> locationBeanList,
                             DeviceBean deviceBean, NetWorkInfoBean netWorkInfoBean, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.saveUserInfo);
        ArrayList<DeviceBean> deviceBeanList = new ArrayList<>();
        deviceBeanList.add(deviceBean);
        requestParams.addParams("deviceList", deviceBeanList);
        if (netWorkInfoBean != null) {
            ArrayList<NetWorkInfoBean> netWorkInfoBeanList = new ArrayList<>();
            netWorkInfoBeanList.add(netWorkInfoBean);
            requestParams.addParams("coninfoList", netWorkInfoBeanList);
        }
        requestParams.addParams("mobileList", contactBeanList);
        requestParams.addParams("locationList", locationBeanList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * @param type 0：in 1：out’
     */
    public void appUsefollow(String type, String deviceId) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("deviceId", deviceId)
                .setUrl(NetWorkConstant.appUsefollow);
        requestParams.addParams("fType", type);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(null));
    }

    /**
     * duplicate
     *
     * @param userName               user name
     * @param commonResponseListener listener
     */
    public void duplicate(String userName, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("username", userName)
                .setUrl(NetWorkConstant.duplicate);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * getRecommendAllList
     *
     * @param commonResponseListener listener
     */
    public void getRecommendAllList(int type, int page, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("fType", String.valueOf(type))
                .addParams("page", String.valueOf(page))
                .addParams("limit", "10")
                .setUrl(NetWorkConstant.getRecommendAllList);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get app version
     *
     * @param commonResponseListener listener
     */
    public void getAppVersion(CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .setUrl(NetWorkConstant.getVersion);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }

    /**
     * get  getDeviceInfo
     *
     * @param androidId              androidId
     * @param commonResponseListener listener
     */
    public void getDeviceInfo(String androidId, CommonResponseListener commonResponseListener) {
        RequestParams requestParams = getCommonRequestParams()
                .addParams("deviceId", androidId)
                .setUrl(NetWorkConstant.getDeviceInfo);
        CommonOkHttpClient.getInstance().postJson(requestParams, new DisposeDataHandle(commonResponseListener));
    }
}
